package com.zhen.aikan.controller;

import com.zhen.aikan.entity.User;
import com.zhen.aikan.service.IUtilService;
import com.zhen.aikan.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author LiJiaZhen
 * @date 2023/9/20 17:10
 */
@Api(tags = "token控制器")
@RestController
@RequestMapping("/api/token")
public class TokenController {
    @Autowired
    private IUtilService utilService;

    @ApiOperation("通过token获取用户信息")
    @GetMapping("/getUserByToken")
    public Result getUserByToken(@RequestParam(name = "token",defaultValue = "") String token){
        Map<Object, Object> userMap = utilService.getUserByToken(token);
        return Result.ok(userMap);
    }
}
